﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="/js/jquery-1.6.2.min.js" type="text/javascript"> </script>
    <script src="/js/bootstrap.min.js" type="text/javascript"> </script>
    <script src="/services/EventFetchingClientSideService.js" type="text/javascript"> </script>
    <script src="/js/knockout-1.2.1.js" type="text/javascript"> </script>
    <script src="/js/flotr2.min.js" type="text/javascript"> </script>
    <script src="/js/flashcanvas.js" type="text/javascript"> </script>
    </head>
    <style type="text/css">
        body {
            margin: 0px;
            padding: 0px;
        }

        #container {
            width: 600px;
            height: 384px;
            margin: 8px auto;
        }
    </style>
<body>
    <h1>DishDash Dashboard Test Page: UI to Middleware Test:</h1>
    <h2> Invoke GetCategoryData operation on CategoryService</h2>
    <br />
    <p>This simple functional test is designed to test the interaction between the html front end, The javascript service wrapper and the middleware service of the Dishdash Dashboard.</p>
    <p>Once clicked, the button invokes a piece of inline javascript, which in turn invokes an external javascript wrapper, the wrapper will then invoke the middleware service and the result of which will be returned.</p>
    <br />
    <br />
<div id="container" draggable="true"></div>
    <script type="text/javascript">

        function RunTest() {
            var request = { LastTimeStampFetched: 0, Precision: "hour", Categories: ["ProfilingApp.Handlers.SecurityHandler.CreateCustomerResponse"] };

            var service = new dishdash.services.EventFetchingClientSideService();

            var getCategoryDataByPrecisionCallback = function(response) {
                alert(response.PrecisionDocuments.length + " items found matching ProfilingApp.Handlers.SecurityHandler.CreateCustomerResponse");
            };

            service.GetCategoryDataByPrecision(request, getCategoryDataByPrecisionCallback);
        }

        ;


        (function() {

            var container = document.getElementById('container'),
                start = (new Date).getTime(),
                data, graph, offset, i;

            // Draw a sine curve at time t

            function animate(t) {

                data = [];
                offset = 2 * Math.PI * (t - start) / 10000;

                // Sample the sine function
                for (i = 0; i < 4 * Math.PI; i += 0.2) {
                    data.push([i, Math.sin(i - offset)]);
                }

                // Draw Graph
                graph = Flotr.draw(container, [data], {
                    yaxis: {
                        max: 2,
                        min: -2
                    }
                });

                // Animate
                setTimeout(function() {
                    animate((new Date).getTime());
                }, 50);
            }

            animate(start);
        })();

    </script>
    <br />
    <br />
    <input type="button" value="Run" onclick=" RunTest() " />

    <br />

</body>
</html>
